<script setup lang="ts">
import { invokeAsyncAPi, registerInformApi } from '@/utils/xz-fn'
import { useUserInfo } from '@/stores/user-info'
import { useDownloadManage } from '@/stores/download-manage'
const userInfoStore = useUserInfo();
const downloadManageStore = useDownloadManage()
//用户头像变更
registerInformApi('Notify_UserHeadImg', (_headImg:string) => {
  userInfoStore.setHeadImg(_headImg+'?v='+(new Date()).getTime());
})
//登录状态变更
registerInformApi('Notify_LoginStatusChange', async (type:number) => {
  if (type === 3) {
    userInfoStore.setIsLogin(true);
  } else {
    userInfoStore.setIsLogin(false);
  }
  const _nickName = await invokeAsyncAPi('fq_GetLoginUserName')
  userInfoStore.setNickName(_nickName);
  const _token = await invokeAsyncAPi('fq_GetLoginToken')
  userInfoStore.setToken(_token);
})
//vip状态变更
registerInformApi('Notify_VipStatusChange', async (_isMember:boolean) => {
  userInfoStore.setIsMember(_isMember);
  downloadManageStore.memberStatusChange();
  const { lift_member, expired_time } = await invokeAsyncAPi('fq_GetVipTimeStatus')
  userInfoStore.setIsNoLimitMember(lift_member)
  userInfoStore.setMemberExpireTime(expired_time)
})
</script>

<template>
  <router-view />
</template>

<style scoped>
</style>
<style lang="scss">
div{
    &::-webkit-scrollbar-thumb {
      background: rgba(59,61,96,0.2);
      border-radius: 20px;
      cursor: pointer;
      width: 6px;
    }
    &::-webkit-scrollbar-thumb:hover {
      background: rgba(59,61,96,0.4);
    }
    &::-webkit-scrollbar-track {
      background: transparent;
    }
    &::-webkit-scrollbar{
      width: 6px;
    }
}
</style>
<style>
html,body{
  margin:0;
}
#app{
  background:#fff;
  position: relative;
  height:100vh;
  /* box-shadow: 0 0 5px #666; */
  border:1px solid #ccc;
  box-sizing: border-box;
  border-radius: 10px;
  overflow: hidden;
}
</style>